//
//  ViewController.m
//  JKOCSkinning
//
//  Created by 王冲 on 2019/1/28.
//  Copyright © 2019年 JK科技有限公司. All rights reserved.
//

#import "ViewController.h"
#import "JKSkinningTool.h"
@interface ViewController ()
{
    
}

@property(nonatomic,strong) UIImageView *bgImageView;

@property(nonatomic,strong) UILabel *bgLabel;

@end

@implementation ViewController

-(UILabel *)bgLabel{
    
    if (!_bgLabel) {
        
        _bgLabel = [[UILabel alloc]initWithFrame:CGRectMake(100, 100, 100, 50)];
        _bgLabel.text = @"往后余生";
        _bgLabel.textAlignment = NSTextAlignmentCenter;
        _bgLabel.backgroundColor = [UIColor brownColor];
    }
    return _bgLabel;
}

-(UIImageView *)bgImageView{
    
    if (!_bgImageView) {
        
        _bgImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
    }
    
    return _bgImageView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
   
    self.view.backgroundColor = [UIColor whiteColor];
    
    UIBarButtonItem *barButtonItem1 = [[UIBarButtonItem alloc]initWithTitle:@"春节" style:UIBarButtonItemStylePlain target:self action:@selector(chunjieClick)];
    UIBarButtonItem *barButtonItem2 = [[UIBarButtonItem alloc]initWithTitle:@"国庆" style:UIBarButtonItemStylePlain target:self action:@selector(guoqing)];
    UIBarButtonItem *barButtonItem3 = [[UIBarButtonItem alloc]initWithTitle:@"中秋" style:UIBarButtonItemStylePlain target:self action:@selector(zhongqiu)];
    self.navigationItem.rightBarButtonItems = @[barButtonItem1,barButtonItem2,barButtonItem3];
    
    // 添加背景图片
    [self.view addSubview:self.bgImageView];
    
    [self.view addSubview:self.bgLabel];

    [self showbgImage];
}

#pragma mark 展示图片
-(void)showbgImage{

    self.bgImageView.image = [JKSkinningTool getBgImage:SkinBack];
    self.bgLabel.textColor = [JKSkinningTool getSkinLabekColorWithType:SkinLabelColor];
}



#pragma mark 春节
-(void)chunjieClick{

    NSLog(@"春节的点击事件");
    [JKSkinningTool saveBgImagePath:ChunJie];
    [self showbgImage];
}

#pragma mark 国庆
-(void)guoqing{
    
    NSLog(@"国庆的点击事件");
    [JKSkinningTool saveBgImagePath:GuoQing];
    [self showbgImage];
    
}

#pragma mark 中秋
-(void)zhongqiu{
    
    NSLog(@"中秋的点击事件");
    [JKSkinningTool saveBgImagePath:ZhongQiu];
    [self showbgImage];
}

@end
